package com.example.chapter09;

public class test2 {
    public static void main(String[] args) {
        String str1 = "apple";
        String str2 = "banana";
        System.out.println(str1.compareTo(str2)); // 输出: -1
        String str11 = "hello";
        String str22 = "hello";
        int result = str11.compareTo(str22); // 输出0
        System.out.println(result);
        String str13 = "banana";
        String str23 = "apple";
        int result2 = str13.compareTo(str23); // 输出1
        System.out.println(result2);
    }
}
